<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    //1.创建数组的方式   字面量创建方式
  var names = ["why","kobe","james","curry"]
  
  var product1 = {name:"苹果",price:10}
  var products = [
    {name:"鼠标",price:98},
    {name:"键盘",price:100},
    {name:"西瓜",price:20},
    product1
  ]
  
 

  console.log(window.Array)

   //2.创建方式二 :类Array
   var arr1 = new Array()
   console.log(arr1)
   var arr2 = new Array("abc","adc","ccc")
   console.log(arr2)

   var arr3 = new Array(5)  //[5],如果只传入数字，这里只代表创建数一个对应长度的数组
   console.log(arr3)

   //数组扩容
   //3.通过索引访问元素
   console.log(names[1])
   console.log(names[names.length-1])
  </script>
</body>
</html>